package com.own.demo.lwf.utils.ownUtils;/**
 * @author liwenfeng
 * @date 2022/8/14 0014
 * @apinote
 */


import org.apache.commons.lang3.StringUtils;

/**
 * @version v1.0
 * @Description:
 * @Author Administrator
 * @Date 2022/8/14 0014 8:04
 * @copyright 李文峰
 */
public class StringUtilsDemo {
    public static void main(String[] args) {
        // 祥见（https://blog.csdn.net/sinat_40770656/article/details/104953883）

        // String.format:替换占位符*********************
        System.out.println(String.format("%s今年%d岁。", "小李", 30));

        // String.indexOf:其他类型转为string
        int ii = 9649945;
        System.out.println(String.valueOf(ii));
        // StringUtils.isEmpty:判断非空，不同于string.emptry即使声明也不会报错
        // StringUtils.isBlank：空白也为true，包括空字符换行等

        String s = "  ";
        System.out.println(StringUtils.isEmpty(s));
        System.out.println(StringUtils.isBlank(s));


        // join：把数组拼成字符串
        String[] arrise = {"张三","李四","秀儿","六六"};
        System.out.println(StringUtils.join(arrise,":"));

        // replace:替换
        String s1 = "oh oh my god";
        System.out.println(StringUtils.replace(s1,"oh","hi"));
    }
}
